using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Collections;
using System.Xml;
using System.Web.UI.WebControls;

/// <summary>
/// Summary description for DAUtility
/// </summary>
    public static class DAUtility
    {
        #region AddOutputParameter
        public static void AddOutputParameter(List<SqlParameter> list, string sParmName)
        {
            SqlParameter sqlParameter = new SqlParameter { ParameterName = sParmName, Direction = ParameterDirection.Output, Value = 0 };
            list.Add(sqlParameter);
        }

        public static void AddOutputParameter(List<SqlParameter> list, string sParmName, SqlDbType dbType)
        {
            SqlParameter sqlParameter = new SqlParameter { ParameterName = sParmName, Direction = ParameterDirection.Output, SqlDbType = dbType };
            list.Add(sqlParameter);
        }

        public static void AddOutputParameter(List<SqlParameter> list, string sParmName, int iSize)
        {
            SqlParameter sqlParameter = new SqlParameter { ParameterName = sParmName, Direction = ParameterDirection.Output, Value = "", Size = iSize };
            list.Add(sqlParameter);
        }
        #endregion

        #region AddInputParameter
        public static void AddInputParameter(List<SqlParameter> list, string sParmName, object sParmValue)
        {
            if (sParmValue == null)
                sParmValue = DBNull.Value;
            list.Add(new SqlParameter(sParmName, sParmValue));
        }

        //Returns input parameter for SqlDataSource
        public static void AddInputParameter(List<Parameter> list, string sParmName, DbType dbType, string sParmValue)
        {
            list.Add(new Parameter(sParmName, dbType, sParmValue));
        }
        public static void AddInputParameter(List<Parameter> list, string sParmName, DbType dbType)
        {
            list.Add(new Parameter(sParmName, dbType));
        }
        #endregion

        #region AddReturnValueParameter
        public static void AddReturnValueParameter(List<SqlParameter> list, string sParmName, SqlDbType dbType)
        {
            SqlParameter sqlParameter = new SqlParameter { ParameterName = sParmName, Direction = ParameterDirection.ReturnValue, SqlDbType = dbType };
            list.Add(sqlParameter);
        } 
        #endregion       

    }



